package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Window.Type;
import java.awt.Frame;
import java.awt.Component;
import javax.swing.JLayeredPane;
import javax.swing.JTabbedPane;
import javax.swing.BoxLayout;
import net.miginfocom.swing.MigLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import javax.swing.UIManager;
import javax.swing.JMenuBar;
import java.awt.Choice;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import java.awt.Label;
import java.awt.TextField;

public class MainGUI extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainGUI frame = new MainGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MainGUI() {
		setExtendedState(Frame.MAXIMIZED_BOTH);
		setTitle("IF Pongratiu Erika - Stock Management");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		tabbedPane.setToolTipText("");
		contentPane.add(tabbedPane);
		
		JPanel mainMenuPane = new JPanel();
		tabbedPane.addTab("Main Menu", null, mainMenuPane, null);
		mainMenuPane.setLayout(new MigLayout("", "[20%][20%][20%][20%][20%]", "[20%][100px][100px]"));
		
		JButton btnAddNewProduct = new JButton("Adding");
		btnAddNewProduct.setFont(btnAddNewProduct.getFont().deriveFont(btnAddNewProduct.getFont().getSize() + 13f));
		btnAddNewProduct.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		mainMenuPane.add(btnAddNewProduct, "cell 1 1,grow");
		
		JButton btnInputOutput = new JButton("Input / Output");
		btnInputOutput.setFont(btnInputOutput.getFont().deriveFont(btnInputOutput.getFont().getSize() + 13f));
		mainMenuPane.add(btnInputOutput, "cell 2 1,grow");
		
		JButton btnRaports = new JButton("Raports");
		btnRaports.setFont(btnRaports.getFont().deriveFont(btnRaports.getFont().getSize() + 13f));
		mainMenuPane.add(btnRaports, "cell 3 1,grow");
		
		JButton btnSearch = new JButton("Search");
		btnSearch.setFont(btnSearch.getFont().deriveFont(btnSearch.getFont().getSize() + 13f));
		mainMenuPane.add(btnSearch, "cell 2 2,grow");
		
		JPanel addingPane = new JPanel();
		tabbedPane.addTab("Adding", null, addingPane, null);
		addingPane.setLayout(new MigLayout("", "[grow][][][][grow]", "[][]"));
		
		Label label = new Label("Car Brand");
		addingPane.add(label, "cell 1 0,alignx center");
		
		Label label_1 = new Label("Model");
		addingPane.add(label_1, "cell 2 0,alignx center");
		
		Label label_2 = new Label("Engine type");
		addingPane.add(label_2, "cell 3 0,alignx center");
		
		JComboBox carBrand = new JComboBox();
		carBrand.setName("carBrand");
		carBrand.setEditable(true);
		carBrand.setModel(new DefaultComboBoxModel(new String[] {"Alfa Romeo", "Audi", "BMW", "Chevrolet", "Chrysler", "Citro\u00EBn", "Dacia", "Daewoo", "Daihatsu", "Dodge", "Fiat", "Ford", "Honda", "Hyundai", "Iveco", "Jaguar", "Jeep", "Kia", "Lancia", "Land Rover", "Lexus", "Mazda", "Mercedes", "Mini", "Mitsubishi", "Nissan", "Opel", "Peugeot", "Porsche", "Renault", "Rover", "Saab", "Seat", "Skoda", "Smart", "Subaru", "Suzuki", "Toyota", "Volkswagen", "Volvo"}));
		addingPane.add(carBrand, "cell 1 1,growx");
		
		TextField carModel = new TextField();
		carModel.setColumns(20);
		carModel.setName("carModel");
		addingPane.add(carModel, "cell 2 1,growx");
		
		TextField textField = new TextField();
		textField.setColumns(15);
		addingPane.add(textField, "cell 3 1");
		
		JPanel panel = new JPanel();
		tabbedPane.addTab("New tab", null, panel, null);
	}

}
